class LazySingleton {
    private static volatile LazySingleton insance = null;
    private static final Object locker = new Object();

    private LazySingleton() {};

    public LazySingleton getInsance() {
        //这个 if 防止已经有实例了，还要获取锁，减少效率
        if(insance == null) {
            synchronized (locker) {
                //这个 if 防止多个线程创建多个实例
                if (insance == null) {
                    insance = new LazySingleton();
                }
            }
        }
        return insance;
    }

}
public class demo14 {

}
